package com.example.myapp;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.myapp.adapter.MyAdapter;
import com.example.myapp.adapter.MyAdapter2;
import com.example.myapp.adapter.MyAdapter3;
import com.example.myapp.bean.UserBean;
import com.example.myapp.bean.UserBeans;


public class RecycleViewActivity extends AppCompatActivity {

    private RecyclerView mRecyclerView;
    private MyAdapter myAdapter;
    private MyAdapter2 myAdapter2;
    private MyAdapter3 myAdapter3;
    private Button addDateBtn;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recycle);
        mRecyclerView=findViewById(R.id.m_recycle);

        LinearLayoutManager manager = new LinearLayoutManager(this);
        mRecyclerView.setLayoutManager(manager);

//        myAdapter =new MyAdapter();
//        myAdapter2 =new MyAdapter2();
        myAdapter3 =new MyAdapter3();
        addDateBtn = findViewById(R.id.btn_1);
//        mRecyclerView.setAdapter(myAdapter);
//        mRecyclerView.setAdapter(myAdapter2);
        mRecyclerView.setAdapter(myAdapter3);
//        addDateBtn.setOnClickListener(new View.OnClickListener(){
//            public void onClick(View view){
//                UserBean bean =new UserBean();
//                bean.setUsername("用户");
//                bean.setHeadID(R.drawable.ic_baseline_arrow_back_ios_24);
//                myAdapter2.addData(bean);
//            }
//        });

        int[] b =new int[]{R.drawable.ic_baseline_filter_1_24, R.drawable.ic_baseline_filter_2_24,
                R.drawable.ic_baseline_filter_3_24, R.drawable.ic_baseline_filter_4_24,
                R.drawable.ic_baseline_filter_5_24, R.drawable.ic_baseline_filter_6_24};

        int[] c =new int[]{R.drawable.number_1, R.drawable.number_2,
                R.drawable.number_3, R.drawable.number_4,
                R.drawable.number_5, R.drawable.number_6};

        String[] d=new String[]{"如何看待郑州一少年扶起倒地老人，垫付的药费要不回来，老人却说：我良心过得去","一个程序员的水平能差到什么水平",
                "如何看待3月1日教育部公布撤销518个本科专业？你的专业被撤销了吗？","你有哪些看过五遍以上的经典电影","哪一个瞬间，你发现祖国比想象中的更强大",
                "如何看待蜡笔小邱忏悔视频曝光"
        };
        addDateBtn.setOnClickListener(new View.OnClickListener(){
            public void onClick(View view){
                for(int i=0;i<6;i++) {
                    UserBeans bean = new UserBeans();
                    bean.setP_1Id(b[i]);
                    bean.setP_2Id(c[i]);
                    bean.setText1(d[i]);
                    bean.setText2((10-i)+"00万热度");
                    myAdapter3.addData(bean);
            }
            }
        });

    }
}
